<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('审核本级回复未处理T')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="post-form">
                <div class="select-list">
                    <ul>
                        <li>
                            工单编号：<input type="text" name="workFormNO"/>
                        </li>
                        <li>
                            派发单位：<input type="text" name="sdeptName"/>
                        </li>
                        <li>
                            审核人员：<input type="text" name="opUserName"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm " id="toolbar" role="group">
            <a class="btn btn-success single disabled" onclick="detail('')">
                <i class="fa"></i> 查看
            </a>
            <a class="btn btn-primary single disabled" onclick="editReply()">
                <i class="fa"></i> 编辑
            </a>
            <a class="btn btn-success multiple disabled" onclick="printX()">
                <i class="fa fa-print"></i> 转办单
            </a>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var prefix = ctx + "system/mTelWF";
    var mInterior = ctx + "system/mInterior";
    $(function () {
        var options = {
            url: prefix + "/cmnFile/muReplyOverJsonData",
            sortName: "myPkVal",
            sortOrder: "desc",
            uniqueId: "myPkVal",
            modalName: "本部门已办毕T",
            fixedColumns: true,
            fixedNumber: 2,
            fixedRightNumber:1,
            columns: [{
                checkbox: true
            },
                {field: '', title: '序号', align: "center", width: 40,formatter:function(value,row,index){return serialNumber(value,row,index);}},
                {field: 'myPkVal', title: 'pkId', hidden: true, visible: false},
                {field: 'wfId', title: 'wfId', hidden: true, visible: false},
                {field: 'telId', title: 'telId', hidden: true, visible: false},
                {field: 'OriLevel', title: 'OriLevel', hidden: true, visible: false},
                {field: 'sbDept', title: 'sbDept', hidden: true, visible: false},
                {field: 'myTwfNO', title: '工单编号', align: 'center', sortable: true},
                {field: 'myTwfTopic', title: '工单主题', align: 'center', sortable: true},
                {field: 'FmContent', title: '工单内容', align: 'center',formatter:function (value, row, index,field) {
                        return "<span style='cursor: pointer;' title='"+value+"'>"+value+"</span>"
                    },
                    cellStyle: cellEllipsis},
                {field: 'SDeptName', title: '来自',align: 'center', hidden: true},
                {field: 'SeqName', title: '交办次序', align: 'center'},
                {field: 'SortName', title: '性质', align: 'center', sortable: true},
                {field: 'DealName', title: '办理方式', align: 'center', hidden: true},
                {field: 'bkLimit', title: '办理期限', align: 'center', sortable: true, width: 80},
                {field: 'SBDeptName', title: '办理单位', align: 'center', sortable: true, width: 80},
                {field: 'bkDate', title: '回复日期', align: 'center', sortable: true, width: 80},
                {field: 'SendState', title: '签收情况', align: 'center', sortable: true, formatter: function (value, row, index) {return fmtSBSendState(value, row, index);}},
                {field: 'BackState', title: '回复情况', align: 'center', sortable: true, formatter: function (value, row, index) {return fmtSBBackState(value, row, index);}},
                {field: 'chgBack', title: '审查情况', align: 'center', sortable: true,formatter:function(value,row,index){return fmtSBBackCheck(value,row,index);}},
                {field: 'BackRemark', title: '备注', align: 'center',  width: 80},
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="detail('+row.WfId+')"><i class="fa"></i>查看</a>');
                        return actions.join('');
                    }
                }
            ]
        };
        $.table.init(options);
    });

    //查看办结工单详情
    function detail(id) {
        var wfId = '';
        if (id === '') {
            let row = $("#bootstrap-table").bootstrapTable('getSelections');
            var wfId = row[0].WfId;
        }else{
            wfId = id;
        }
        if (wfId) {
            var url = ctx + "system/test/caseDetail/"+wfId;
            var title = "办毕工单详情";
            parent.$.modal.openTab(title, url);
        }
    }

    function printX() {
        var url = prefix+"/forShow/printSends";
        let row = $("#bootstrap-table").bootstrapTable('getSelections');
        if (row.length < 2) {
            url += "?ids="+row[0].myPkVal;
        }else {
            var ids = '';
            for (let i = 0; i < row.length; i++) {
                ids += row[i].myPkVal;
                if ((i+1) != row.length) {
                    ids += ","
                }
            }
            url += "?ids="+ids;
        }
        window.open(url,"printX",'left=100,top=20,height=700,width=720,toolbar=yes,menubar=yes,scrollbars=auto');
    }

    //修改办理结果
    function editReply(){
        let row = $("#bootstrap-table").bootstrapTable('getSelections');
        var sendId = row[0].myPkVal;
        if (sendId){
            var url = prefix + "/cmnFile/editReply?sendId="+sendId;
            var title = "修改办理结果"
            parent.$.modal.openTab(title,url);
        }
    }
</script>
</body>
</html>